<%@ Page Language="C#"%>
<%@ Import Namespace="Security"%>
<%@ Import Namespace="System.Web.Services.Protocols" %>

<script runat=server>
  public void Page_Load(){
    span1.InnerHtml = "";
    span2.InnerHtml = "";
  }
  
  public void Authenticate_Click(Object sender, EventArgs e){
    SecureWebService s = new SecureWebService();

    // Create the Authentication header and set values
    Authentication a = new Authentication();
    a.User = user.Value;
    a.Password = password.Value;

    // Assign the Header
    s.AuthenticationValue = a;

    try{
      string result = s.ValidUser();
      span1.InnerHtml = result;
    } 
    catch (SoapException soap) {
      span2.InnerHtml = soap.Message;
    }
  }
</script>
<form runat=server>
	<font size=6> Username:
		<input type=text id=user runat=server />
		<BR>
		Password:
		<input type=text id=password runat=server />
		<P>
			<input type=submit runat=server OnServerClick="Authenticate_Click" value="Login" />
	</font></form>
<hr size=1>
<font size=6>result: <font color=red>
		<span id=span1 runat=server />
	</font></font>
<P>
	<font size=6>error: <font color=red>
			<span id=span2 runat=server />
		</font></font>